package com.mdd.admin.validate.category;

import com.mdd.common.validator.annotation.IntegerContains;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 服务分类参数
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "服务分类请求对象", description = "服务分类请求对象")
public class GoodsCategoryParam implements Serializable {

    private static final long serialVersionUID = 1L;

    public interface create{}
    public interface update{}
    public interface delete{}

    @NotNull(message = "id参数必传且需大于0", groups = {update.class, delete.class})
    @ApiModelProperty(value = "主键id")
    private Long id;

    @NotNull(message = "name参数缺失", groups = {create.class, update.class})
    @Length(max = 90, message = "name参数不能超出90个字符", groups = {create.class, update.class})
    @ApiModelProperty(value = "名称")
    private String name;

    @NotNull(message = "pid参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "pid参数值不能少于0", groups = {create.class, update.class})
    @ApiModelProperty(value = "pid")
    private Long pid;

    @NotNull(message = "level参数缺失", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "level参数值不能少于0", groups = {create.class, update.class})
    @ApiModelProperty(value = "等级")
    private Integer level;

    @NotNull(message = "image参数缺失", groups = {create.class, update.class})
    @Length(max = 255, message = "image参数不能超出255个字符", groups = {create.class, update.class})
    @ApiModelProperty(value = "分类图标")
    private String image;

    @NotNull(message = "排序值不能为空", groups = {create.class, update.class})
    @DecimalMin(value = "0", message = "sort参数值不能少于0", groups = {create.class, update.class})
    @ApiModelProperty(value = "排序")
    private Integer sort;

    @NotNull(message = "isShow参数缺失", groups = {create.class, update.class})
    @IntegerContains(values = {0, 1}, message = "isShow参数值不在符合范围", groups = {create.class, update.class})
    @ApiModelProperty(value = "是否显示:1-是;0-否")
    private Integer isShow;

    @NotNull(message = "isRecommend参数缺失", groups = {create.class, update.class})
    @IntegerContains(values = {0, 1}, message = "isRecommend参数值不在符合范围", groups = {create.class, update.class})
    @ApiModelProperty(value = "是否首页推荐:1-是;0-否;")
    private Integer isRecommend;

}
